﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

using System.Data;
using System.Collections;

namespace SmartProject.Data
{
    /// <summary>
    /// The IDataProvider defines the contract for any database implementation used by SmartProject.
    /// </summary>
    public interface IDataProvider
    {
        /// <summary>
        /// Initializes the IDataProvider implementation and acts as a reset function.
        /// </summary>
        void Initialize();

        /// <summary>
        /// Executes a query that returns only one row. The single row in then converted
        /// into a Hashtable for ease of access.
        /// </summary>
        /// <param name="storedProcedure">Stored procedure to execute.</param>
        /// <returns>Hashtable.</returns>
        Hashtable Load(string storedProcedure);

        /// <summary>
        /// Executes a query that returns a DataTable.
        /// </summary>
        /// <param name="storedProcedure">Stored procedure to execute.</param>
        /// <returns>DataTable.</returns>
        DataTable Find(string storedProcedure);

        /// <summary>
        /// Adds a parameter with a string value.
        /// </summary>
        /// <param name="name">Name of the parameter.</param>
        /// <param name="value">Value of the string parameter.</param>
        /// <param name="size">Size of the string parameter.</param>
        void Add(string name, string value, int size);

        void Add(string name, DateTime value);

        void Add(string name, byte[] value);

        void Add(string name, bool value);

        void Add(DataParameter dataParameter);

        void Add(string name, int value);

        /// <summary>
        /// Gets the return row Id when you attempt to insert a new row.
        /// </summary>
        int ReturnId { get; }

        void Run(string storedProcedure);
    }
}
